In many applications, it is desirable to store the output of a counter in a non-volatile memory, such that if power is lost, the last count will be retained. For example, in an automobile odometer, the accrued mileage must be retained even during loss of power in order to reliably reflect the mileage of the automobile. Hence, in order to implement a digital electronic odometer, some type of non-volatile memory backup is necessary. Similarly, an electronic power meter would need some non-volatile memory backup, since loss of usage data would mean a loss in revenue.
EEPROMs are often used for non-volatile storage of data, because they may be electronically erased. In a counting application, however, it is desirable to store each incremented counter value in order to prevent the loss of any data. As a result, the least significant bits of an EEPROM memory undergo many more bit transitions than do the most significant bits. The least significant bit changes from a "one" to a "zero" or from a "zero" to a "one" on each count. The most significant bit will undergo a transition from a zero to a one only once during the entire range of values output by the counter.
Each transition between logic states creates stress on the associated bit. EEPROM memory cells are typically rated to withstand over 10,000 bit transitions. After 10,000 transitions, an EEPROM memory cell is considered unreliable. Consequently, if a counter sequences through 10,000 binary outputs, the least significant bit of a EEPROM memory storing each output will become unreliable for data storage. Therefore, if an application requires a sequence of numbers greater than 10,000, the EEPROM will cease to be a reliable storage medium. Furthermore, in practice, a cell may fail before the rated number of transitions; consequently, if an application, such as an odometer, requires a reliable storage mechanisms, the EEPROM rating cannot be relied upon.
One solution to the aforementioned problem is to shift to a new group of memory locations after a predetermined number of writes. For example, for a 24-bit counter, three memory locations would be needed. If locations 100h to 102h ("h" denotes a hexadecimal number representation) were used to store the output of the 24-bit counter, after 10,000 transitions, locations 103h to 105h would be used to store the output. This solution, however, wastes memory since memory location 101h has had only moderate use and memory location 102h has had no use.
Therefore, a need has arisen in the industry to provide a method and apparatus for reliably storing the output of a counter in a non-volatile memory and for detecting and correcting errors.